package com.founder.gateway.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
/**
 * 
 * @author: hfl 
 * @date:   2018年6月27日 下午2:53:00
 */
@RestController
public class HelloWorldController {
    @RequestMapping("/")
    @ResponseBody
    @SentinelResource("index")
    public String index(){
    	HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
        response.setHeader("Access-Control-Allow-Origin", "*");
        return "hello world";
    }


}